var app = getApp()
//常量数据配置
var ConstantData = require('../../../common/constant_data')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    ruleList: [],
    showRuleStr:'',
     // 交易保障标配置
     jybzConfig: {
      pageType: 'goods_detail',
      goodsName: 'e家康护共享轮椅',
      goodsImg: 'https://www.ejiakanghu.cn/images/mini_tip/home_ad_top.png',
      goodsPrice: '租金￥0.00元起',
      align: 'between',
      spaceSize: 12,
      bannerStyle: {
        fontSize: 'mini',
        fontOpacity: 'gray',
      },
    },
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let selectOrder=options.selectOrder?JSON.parse(decodeURIComponent(options.selectOrder)):'' 
    this.setData({
      selectOrder:options.selectOrder?selectOrder:options.selectOrder,
      noLoginFlg:options.noLoginFlg,
      networkType:!app.globalData.networkIsCon?'none':'1'
    })
    console.log(333,this.data.selectOrder,this.data.noLoginFlg,this.data.networkType)
    if(options.selectOrder){
      this.getRuleDetail(this.data.selectOrder.orderCode)
    } 
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },
  getRuleDetail(orderCode){
    let that=this
    wx.showLoading({
      title: '加载中...',
      mask: true
    });
    app.executeRequest(function (header) {
      wx.request({
        url: ConstantData.CONSTATNT_DATA.BASE_URL + `/lease/costRule/${orderCode}`,
        method: 'get',
        header: header,
        success: function (res) {
          console.log("userRecordsList-->", res);
          if (res.data.result == 0) {
           that.setData({
            ruleList:res.data.data.ruleLists,
            showRuleStr:res.data.data.showRuleStr
           })
          } else {
            wx.showToast({
              title: '获取失败'
            })
          }
        },
        complete() {
          getApp().hideLoading()
        }
      })
    })
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})